package com.hades.xq.seckill.dao;

import com.hades.xq.seckill.dao.dto.TbSeckill;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.util.Date;
import java.util.List;

public interface TbSeckillMapper extends Mapper<TbSeckill> {

    /**
     * 减库存
     *
     * @param seckillId
     * @param killTime
     * @return
     */
    int reduceNumber(@Param("seckillId") Long seckillId, @Param("killTime") Date killTime);

    /**
     * 根据ID查询秒杀商品
     *
     * @param seckillId
     * @return
     */
    TbSeckill quaryById(Long seckillId);

    /**
     * 根据偏移量查询秒杀商品列表
     *
     * @param offet
     * @param limit
     * @return
     */
    List<TbSeckill> quaryAll(@Param("offet") int offet, @Param("limit") int limit);
}